﻿using DataCenter.Entitys;
using DataCenter.IRepository;
using DataCenter.Service.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataCenter.Service.Implementations
{
    public class ProductService : IProductService
    {

        private readonly IProductRepository repository;

        public ProductService(IProductRepository productrepository)
        {
            repository=productrepository;
        }

        public async Task<int> Add(Product customer)
        {
           return await repository.Add(customer);
        }

        public async Task<int> Delete(Guid id)
        {
           return await repository.DeleteById(id);  
        }

        public async Task<IEnumerable<Product>> GetAll()
        {
            var data = await repository.GetAll();
            return data;
        }

        public async Task<Product> GetById(Guid id)
        {
             return  await repository.GetById(id);
        }

        public async Task<int> Update(Product customer)
        {
          return await repository.Update(customer);
        }
    }
}
